﻿@model ThaireInvestmentWeb.Models.CouponTableAndAmortizeModel
@{
    ViewBag.Title = "CouponTableAndAmortize";
}

<p>

    <table class="navi" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td style="width: 100%;">
                <div class="navi">Instrument Type > <a href="fixedIncomeList">Fixed Income List</a>> <a href="fixedIncome">Header </a>> <a href="add_purchase">Purchase </a>> Coupon Table & Amortize </div>
            </td>
        </tr>
    </table>

</p>


<table class="tableheader" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td height="38" align="center" style="width: 100%; text-align: center;">Coupon Table &amp; Amortize</td>
    </tr>
</table>
@using(Html.BeginForm("Amor"))
{
<table width="951" border="0" align="center">
    <tr>
        <td>


            <table class="tableform" width="100%" border="0" align="center" cellspacing="2">
                <tr>
                    <td width="212">
                        <div align="right">Symbol  : </div>
                    </td>
                    <td width="8">&nbsp;</td>
                    <td width="246">@Html.TextBoxFor(x => x.Symbol, new { @readonly = "readonly" })</td>
                    <td width="188">&nbsp;</td>
                    <td width="6">&nbsp;</td>
                    <td width="208">&nbsp;</td>
                </tr>
                <tr>
                    <td>
                        <div align="right">Par Value  : </div>
                    </td>
                    <td>&nbsp;</td>
                    <td>@Html.TextBoxFor(x => x.FaceValue, new { @readonly = "readonly", @class = "inputNumberField" })</td>
                    <td>
                        <div align="right">IRR per Day : </div>
                    </td>
                    <td>&nbsp;</td>
                    <td>@Html.TextBoxFor(x => x.IRRPerDayPercent, new { @readonly = "readonly", @class = "inputNumberField" })
                        % </td>
                </tr>
                <tr>
                    <td>
                        <div align="right">Clean Price    : </div>
                    </td>
                    <td>&nbsp;</td>
                    <td>
                       @Html.TextBoxFor(x => x.CleanPrice, new { @readonly = "readonly", @class = "inputNumberField" })</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>
                        <div align="right">Discount / Premium : </div>
                    </td>
                    <td>&nbsp;</td>
                    <td>@Html.TextBoxFor(x => x.DiscountPremium, new { @readonly = "readonly", @class = "inputNumberField" })</td>
                    <td>
                        <div align="right"></div>
                    </td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>
                        <div align="right">Accrued Interest  : </div>
                    </td>
                    <td>&nbsp;</td>
                    <td>@Html.TextBoxFor(x => x.AI, new { @readonly = "readonly", @class = "inputNumberField" })</td>
                     <td>
                        <div align="right">Coupon Rate : </div>
                    </td>
                    <td>&nbsp;</td>
                    <td>@Html.TextBoxFor(x => x.CouponRate, new { @readonly = "readonly", @class = "inputNumberField" })
                        % </td>
                </tr>
                <tr>
                    <td>
                        <div align="right">Gross Price/Dirty Price   : </div>
                    </td>
                    <td>&nbsp;</td>
                    <td>@Html.TextBoxFor(x => x.GrossPrice, new { @readonly = "readonly", @class = "inputNumberField" })</td>
                    <td>
                        <div align="right">YTM : </div>
                    </td>
                    <td>&nbsp;</td>
                    <td>
                        @Html.TextBoxFor(x => x.YTM, new { @readonly = "readonly", @class = "inputNumberField" }) % </td>
                </tr>
              
                <tr>
                    <td>
                        <div align="right">Purchase  Date   : </div>
                    </td>
                    <td>&nbsp;</td>
                    <td>@Html.TextBoxFor(x => x.TradeDate, new { @readonly = "readonly" })
                    </td>
                    <td>
                        <div align="right">Maturity Date   : </div>
                    </td>
                    <td>&nbsp;</td>
                    <td>@Html.TextBoxFor(x => x.MaturityDate, new { @readonly = "readonly" })</td>
                </tr>

               

            </table>
            <table class="tableform" width="100%" border="0">
                <tr>
                    <td>
                        <div style="width: 100%; overflow: auto;">

                            @if (Model.AmortizeData.AmortizeDetailList != null)
                            {
                                var grid = new WebGrid(source: Model.AmortizeData.AmortizeDetailList, ajaxUpdateContainerId: "grid", canPage: false, canSort: false);
                                @grid.GetHtml(htmlAttributes: new { id = "grid" }, tableStyle: "tablelist", headerStyle: "headertable", displayHeader: @Model.AmortizeData.AmortizeDetailList.Length > 0,
            columns: grid.Columns(


                grid.Column(columnName: "Period", style: "columnNumber", header: "Period", canSort: false),
                grid.Column(header: "Date", format: @<text> @ThaireInvestmentWeb.Util.WebUtil.FormatDate(item.AmortizeDate) </text>),

                grid.Column(columnName: "NOOFDays", header: "No. of days", canSort: false),

                grid.Column(header: "Coupon", style: "columnNumber", format: @<text> @ThaireInvestmentWeb.Util.WebUtil.FormatDecimal2Digit(item.Coupon) </text>),
                grid.Column(header: "Interest", style: "columnNumber", format: @<text> @ThaireInvestmentWeb.Util.WebUtil.FormatDecimal2Digit(item.Interest) </text>),
                grid.Column(header: "Discount / Premium", style: "columnNumber", format: @<text> @ThaireInvestmentWeb.Util.WebUtil.DisplayXIfNullOrZero( ThaireInvestmentWeb.Util.WebUtil.FormatDecimal2Digit(item.DiscountPremium)) </text>),
                grid.Column(header: "Book value", style: "columnNumber", format: @<text> @ThaireInvestmentWeb.Util.WebUtil.FormatDecimal2Digit(item.BookValue) </text>)


                ));


                            }


                        </div>
                    </td>
                </tr>
            </table>
            <table class="tableform" width="100%" border="0">
                <tr>
                    <td>
                        <input type="submit" name="BtnExportExcel" id="BtnExportExcel" value="Export to Excel" class="button" />

                    </td>
                </tr>
            </table>
            <br>
        </td>
    </tr>
</table>
}